package com.example.demo.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.time.LocalDateTime;

@Data
@TableName("`user`")
public class User {
    @TableId(type = IdType.AUTO)
    private Long id;
    
    @TableField("Account")
    private String account;
    
    @TableField("Password")
    private String password;
    
    @TableField("password_confirm")
    private String passwordConfirm;
    
    @TableField("valid_code")
    private String validCode;
    
    @TableField("phone_number")
    private Long phoneNumber;
    
    @TableField("Name")
    private String name;
    
    @TableField("Avatar")
    private String avatar;
    
    // 用户权益信息
    @TableField("TotalTokens")
    private Integer totalTokens;          // 总剩余token数量（-1表示无限制）
    
    @TableField("TotalValidityDays")
    private Integer totalValidityDays;   // 总剩余有效天数（-1表示永久）
    
    @TableField("ExpiresAt")
    private LocalDateTime expiresAt;     // 权益过期时间（NULL表示永久有效）
    
    @TableField("LastBenefitUpdate")
    private LocalDateTime lastBenefitUpdate; // 权益最后更新时间
    
    @TableField(value = "CreatedAt", fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    
    @TableField(value = "UpdatedAt", fill = FieldFill.UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;
}